<template>
  <view class="navbar" :style="{ paddingTop: safeAreaInsets?.top + 'px' }">
    <!-- logo文字 -->
    <view class="logo">
      <image class="logo-image" src="@/static/images/logo.png"></image>
      <text class="logo-text">新鲜 · 亲民 · 快捷</text>
    </view>
    <!-- 搜索条 -->
    <view class="search">
      <text class="icon-search">搜索商品</text>
      <text class="icon-scan"></text>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue'

//获取安全区域
const { safeAreaInsets } = uni.getSystemInfoSync()
</script>

<style scoped lang="scss">
.navbar {
  background-image: url('@/static/images/navigator_bg.png');
  background-size: cover;
  // position:relative;
  display: flex;
  flex-direction: column;
  padding-top: 20px;

  .logo {
    position: relative; /* 相对于正常位置定位 */
    display: flex;
    align-items: center;
    height: 64rpx;
    padding-left: 30rpx;
    padding-top: 20rpx;
    .logo-image {
      width: 166rpx;
      height: 39rpx;
    }
    .logo-text {
      flex: 1;
      line-height: 28rpx;
      font-size: 26rpx;
      color: #fff;
      padding-left: 20rpx;
      margin: 2rpx 0 0 20rpx;
      border-left: 1rpx solid #fff;
    }
  }
  .search {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64rpx;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 32rpx;
    color: #fff;
    margin: 16rpx 20rpx;
    font-size: 28rpx;
    padding: 0 10rpx 0 26rpx;

    .icon-search {
      &::before {
        margin-right: 10rpx;
      }
    }

    .icon-scan {
      font-size: 30rpx;
      padding: 15rpx;
    }
  }
}
</style>
